
import 'package:flutter/material.dart';
import 'package:flutter_demo/advance/event_notify/event_bus.dart';
import 'package:flutter_demo/advance/event_notify/gesture_route.dart';
import 'package:flutter_demo/advance/event_notify/notificaton_routes.dart';
import 'package:flutter_demo/advance/event_notify/pointer_event_route.dart';
import 'package:flutter_demo/start_up/basic_widges/button_widget_route.dart';
import 'package:flutter_demo/start_up/basic_widges/checking_widget_route.dart';
import 'package:flutter_demo/start_up/basic_widges/image_widget_route.dart';
import 'package:flutter_demo/start_up/basic_widges/indicator_widget_route.dart';
import 'package:flutter_demo/start_up/basic_widges/input_widget_route.dart';
import 'package:flutter_demo/start_up/basic_widges/state_route.dart';
import 'package:flutter_demo/start_up/basic_widges/state_x_route.dart';
import 'package:flutter_demo/start_up/basic_widges/text_widget_route.dart';
import 'package:flutter_demo/constants/constants.dart';
import 'package:flutter_demo/start_up/container/clip_routes.dart';
import 'package:flutter_demo/start_up/container/constrained_box_routes.dart';
import 'package:flutter_demo/start_up/container/container_routes.dart';
import 'package:flutter_demo/start_up/container/decorated_box_routes.dart';
import 'package:flutter_demo/start_up/container/padding_routes.dart';
import 'package:flutter_demo/start_up/container/transform_routes.dart';
import 'package:flutter_demo/start_up/function_widgets/7.2_share_data_widget_routes.dart';
import 'package:flutter_demo/start_up/function_widgets/7.5_async_builder_routes.dart';
import 'package:flutter_demo/start_up/function_widgets/alerts_routes.dart';
import 'package:flutter_demo/start_up/function_widgets/colors_routes.dart';
import 'package:flutter_demo/start_up/function_widgets/provider_routes.dart';
import 'package:flutter_demo/start_up/function_widgets/theme_routes.dart';
import 'package:flutter_demo/start_up/function_widgets/will_pop_scope.dart';
import 'package:flutter_demo/start_up/introduction/argument_route.dart';
import 'package:flutter_demo/start_up/introduction/aspect_route.dart';
import 'package:flutter_demo/start_up/introduction/counter_route.dart';
import 'package:flutter_demo/start_up/introduction/new_route.dart';
import 'package:flutter_demo/start_up/layout/align_layout.dart';
import 'package:flutter_demo/start_up/layout/flex_layout_route.dart';
import 'package:flutter_demo/start_up/layout/flow_layout_route.dart';
import 'package:flutter_demo/start_up/layout/positioned_route.dart';
import 'package:flutter_demo/start_up/layout/stack_route.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/custom_scroll_view_routes.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/grid_view_routes1.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/grid_view_routes2.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/list_view_routes1.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/list_view_routes2.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/list_view_routes3.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/scroll_controller_routes1.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/scroll_controller_routes2.dart';
import 'package:flutter_demo/start_up/scrollable_widgets/single_child_scrollView_routes.dart';

class RoutesManager {
  static RoutesManager manager = RoutesManager();

  List pages = <_RoutesModel>[
    _RoutesModel(title: "Open New Route", routes: Constants.routes.newPage, widget: (context) => NewRoute()),
    _RoutesModel(title: "Open Params Page", routes: Constants.routes.paramsPage, widget: (context) =>  ArgumentPage()),
    _RoutesModel(title: "Open Aspect Page", routes: Constants.routes.aspectPage, widget: (context) =>  AspectRoute()),
    _RoutesModel(title: "Open Counter Page", routes: Constants.routes.counterPage, widget: (context) =>  CounterPage()),

    _RoutesModel(title: "Open State Page", routes: Constants.routes.stateXPage, widget: (context) =>  StateXPage()),
    _RoutesModel(title: "Open State Control Page", routes: Constants.routes.statePage, widget: (context) =>  StatePage()),
    _RoutesModel(title: "Open Text Widget Page", routes: Constants.routes.textWidgetPage, widget: (context) => TextWidgetPage()),
    _RoutesModel(title: "Open Button Widget Page", routes: Constants.routes.buttonWidgetPage, widget: (context) => ButtonWidgetPage()),
    _RoutesModel(title: "Open Image Widget Page", routes: Constants.routes.imageWidgetPage, widget: (context) => ImageWidgetPage()),
    _RoutesModel(title: "Open Checking Widget Page", routes: Constants.routes.checkingWidgetPage, widget: (context) => CheckingWidgetPage()),
    _RoutesModel(title: "Open Input Widget Page", routes: Constants.routes.inputWidgetPage, widget: (context) => InputWidgetPage()),
    _RoutesModel(title: "Open Indicator Widget Page", routes: Constants.routes.indicatorWidgetPage, widget: (context) => IndicatorWidgetPage()),

    _RoutesModel(title: "Open Flex Layout Page", routes: Constants.routes.flexLayoutPage, widget: (context) => FlexLayoutPage()),
    _RoutesModel(title: "Open Flow Layout Page", routes: Constants.routes.flowLayoutPage, widget:  (context) => FlowLayoutPage()),
    _RoutesModel(title: "Stack Layout Page", routes: Constants.routes.stackLayoutPage, widget: (context) => StackLayoutPage()),
    _RoutesModel(title: "Positioned Layout Page", routes: Constants.routes.positionedLayoutPage, widget: (context) => PositionedLayoutPage()),
    _RoutesModel(title: "Align Layout Page", routes: Constants.routes.alignLayoutPage, widget: (context) => AlignLayoutPage()),
    _RoutesModel(title: "Padding Container Page", routes: Constants.routes.paddingContainerPage, widget: (context) => PaddingPage()),
    _RoutesModel(title: "Constrained Box Page", routes: Constants.routes.constrainedBoxPage, widget:  (context) => ConstrainedBoxPage()),
    _RoutesModel(title: "Decorated Box Page", routes: Constants.routes.decoratedBoxPage, widget: (context) => DecoratedBoxPage()),
    _RoutesModel(title: "Transform Page", routes: Constants.routes.transformPage, widget: (context) => TransformPage()),
    _RoutesModel(title: "Container Page", routes: Constants.routes.containerPage, widget: (context) => ContainerPage()),
    _RoutesModel(title: "Clip Page", routes: Constants.routes.clipPage, widget: (context) => ClipPage()),

    _RoutesModel(title: "Single Child Scroll View Page", routes: Constants.routes.singleChildScrollViewPage, widget: (context) => SingleChildScrollViewPage()),
    _RoutesModel(title: "List View Page 1", routes: Constants.routes.listViewPage1, widget: (context) => ListView1Page()),
    _RoutesModel(title: "List View Page 2", routes: Constants.routes.listViewPage2, widget: (context) => ListView2Page()),
    _RoutesModel(title: "List View Page 3", routes: Constants.routes.listViewPage3, widget: (context) => ListView3Page()),
    _RoutesModel(title: "Grid View Page 1", routes: Constants.routes.gridViewPage1, widget: (context) => GridViewPage1()),
    _RoutesModel(title: "Grid View Page 2", routes: Constants.routes.gridViewPage2, widget: (context) => GridViewPage2()),
    _RoutesModel(title: "Custom Scroll View Page", routes: Constants.routes.customScrollViewPage, widget: (context) => CustomScrollViewPage()),
    _RoutesModel(title: "Scroll Controller Page 1", routes: Constants.routes.scrollController1Page, widget: (context) => ScrollControllerPage1()),
    _RoutesModel(title: "Scroll Controller Page 2", routes: Constants.routes.scrollController2Page, widget: (context) => ScrollControllerPage2()),

    _RoutesModel(title: "Will Pop Scope Page", routes: Constants.routes.willPopScopePage, widget:(context) => WillPopScopePage()),
    _RoutesModel(title: "Share Data Widget Page", routes: Constants.routes.shareDataWidgetPage, widget: (context) => InheritedWidgetTestRoute()),
    _RoutesModel(title: "Provider Widget Page", routes: Constants.routes.providerWidgetPage, widget: (context) => ProviderRoute()),
    _RoutesModel(title: "Colors Page", routes: Constants.routes.colorsPage, widget: (context) => ColorsPage()),
    _RoutesModel(title: "Themes Page", routes: Constants.routes.themesPage, widget: (context) => ThemesPage()),
    _RoutesModel(title: "Future Builder Page", routes: Constants.routes.asyncBuilderPage, widget: (context) => AsyncBuilderPage()),
    _RoutesModel(title: "Alerts Page", routes: Constants.routes.alertsPage, widget: (context) => AlertsPage()),

    _RoutesModel(title: "Pointer Event", routes: Constants.routes.pointerEventPage, widget: (context) => PointerEventPage()),
    _RoutesModel(title: "Gesture Page", routes: Constants.routes.gesturePage, widget: (context) => GesturePage()),
    _RoutesModel(title: "Event Bus Page", routes: Constants.routes.eventBusPage, widget: (context) => EventBusPage()),
    _RoutesModel(title: "Notification Page", routes: Constants.routes.notificationPage, widget: (context) => NotificationPage()),
    
  ];

  Map get routes {
    var rts = <String, WidgetBuilder>{};

    for (var page in pages) {
      rts[page.routes] = page.widget;
    }
    
    return rts;
  }
}


class _RoutesModel {
  _RoutesModel({
    @required this.title, 
    @required this.routes,
    @required this.widget
  });

  final String title;
  final String routes;
  final WidgetBuilder widget;
}